home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / unix / volume10 / cbw / part04 < prev    next >
Encoding:
Internet Message Format  |  1987-06-16  |  56.0 KB

  1. Path: seismo!uunet!rs
  2. From: rs@uunet.UU.NET (Rich Salz)
  3. Newsgroups: comp.sources.unix
  4. Subject: v10i004:  Crypt Breaker's Workbench, Part04/11
  5. Message-ID: <376@uunet.UU.NET>
  6. Date: 17 Jun 87 22:41:49 GMT
  7. Organization: UUNET Communications Services, Arlington, VA
  8. Lines: 1715
  9. Approved: rs@uunet.uu.net
  10.  
  11. Submitted by: Robert W. Baldwin <BALDWIN@XX.LCS.MIT.EDU>
  12. Mod.sources: Volume 10, Issue 4
  13. Archive-name: cbw/Part04
  14.  
  15.  
  16. #! /bin/sh
  17. # This is a shell archive.  Remove anything before this line, then unpack
  18. # it by saving it into a file and typing "sh file".  To overwrite existing
  19. # files, type "sh file -c".  You can also feed this as standard input via
  20. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  21. # will see the following message at the end:
  22. #        "End of archive 4 (of 11)."
  23. # Contents:  UU.test UU.test1 autotri.c dline.c specs.h test.txt user.c
  24. # Wrapped by rs@uunet on Wed Jun 17 18:17:13 1987
  25. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  26. if test -f UU.test -a "${1}" != "-c" ; then 
  27.   echo shar: Will not over-write existing file \"UU.test\"
  28. else
  29. echo shar: Extracting \"UU.test\" \(8718 characters\)
  30. sed "s/^X//" >UU.test <<'END_OF_UU.test'
  31. Xbegin 644 test.cipher
  32. XMK^D=OM^/7]Q/RL"9_4AY*RCP`/[KZHU"6Z5:W(U05KF^@U%0-+PS8[6OL_^F
  33. XM.4\,B+%AZ"3`@N&T\3#<LMVP!/'#]*C7-6"V5?!3-^4.!I$`^OXT!\L53\O9
  34. XMPL&FC'**K^/D\$#7[28E!:7SHS0&E'GW!$CJ7/A:.?$JE-`5%1,76RXB[6-?
  35. XM`9.9[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A
  160. XM0=G8VA%X%D?F?=9`D8/<\S0;&D(]X78T/M,[B4EO'`T*,2<_L6O%6^%,`.;E
  161. XM"EZO"F"KX0N5J'.A"0]]5B80WY;@U/329?ED</A@`83ZD/8]Q3L4^Q(Y#>OM
  162. XMH.H+,CV6YB::&6[9=(\ERG54!QP(!RE\ZC(#E?IGU.?!JJGX?0"C=W:,(IAR
  163. XMB'/H.%PO7'^Q7FAY?&DZ-C)AEPF5<80@[0,*"OZ:+Z*A/AD&=CIJ))E&7@>M
  164. XME(!)XGSJ=SB\O0Z`%24J/$5ZD3$Z5CC@?,6)$S-N(F"3J0R-GZ:*J4<;H:/@
  165. XM]3R'MK6(^:592#\[.N::Y\L2:E-_/,PZZ$(O;=HI3^$KKV9U-Y;6CK"A1"[]
  166. XMXB=K7EW8.UX@06-<=N7,,QPZ=BRH2BQ&OD09>ZZJ<V979`W!>[^3L[R[:KF-
  167. XMP[;*R>7G6M38"C"KS`TG?=V56=K1H:FL(XK_FPXO_*NJ&JAG">S'TSM+19O=
  168. XMW#"#BR/,#`N/_*?!DO=/O0Y_%12!+0BZ19-*1[^9F"BF$"IG;X(XCQ_[!,7$
  169. XM97F<,BM5J!LU"86<2)JEM7\.E1RA%0(N+8A+MCS$\D::)'_%$*RK[GV6F#^3
  170. XME3R0%`_G^;&P!(CA=NO9"`VG"]G4,V@R2<]$.U]3*[S4N+>VD3:&QC30LJX(
  171. XMZ!!85W(6Q'?^47>+WQ>(8+HLAF.P);1V<>UY>"X`37J:)E=#^6Y>(L2`ET,S
  172. X%A:$T1XP6
  173. X`
  174. Xend
  175. END_OF_UU.test
  176. if test 8718 -ne `wc -c <UU.test`; then
  177.     echo shar: \"UU.test\" unpacked with wrong size!
  178. fi
  179. # end of overwriting check
  180. fi
  181. if test -f UU.test1 -a "${1}" != "-c" ; then 
  182.   echo shar: Will not over-write existing file \"UU.test1\"
  183. else
  184. echo shar: Extracting \"UU.test1\" \(8715 characters\)
  185. sed "s/^X//" >UU.test1 <<'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,REO#T7BD
  327. X!&"HX
  328. X`
  329. Xend
  330. END_OF_UU.test1
  331. if test 8715 -ne `wc -c <UU.test1`; then
  332.     echo shar: \"UU.test1\" unpacked with wrong size!
  333. fi
  334. # end of overwriting check
  335. fi
  336. if test -f autotri.c -a "${1}" != "-c" ; then 
  337.   echo shar: Will not over-write existing file \"autotri.c\"
  338. else
  339. echo shar: Extracting \"autotri.c\" \(7624 characters\)
  340. sed "s/^X//" >autotri.c <<'END_OF_autotri.c'
  341. X/*
  342. X * Automatic guessing based on trigrams.
  343. X *
  344. X * Bob Baldwin, January 1985.
  345. X */
  346. X
  347. X#include    <stdio.h>
  348. X#include    <math.h>
  349. X#include    "window.h"
  350. X#include    "terminal.h"
  351. X#include    "layout.h"
  352. X#include    "specs.h"
  353. X#include    "cipher.h"
  354. X#include    "autotri.h"
  355. X
  356. X
  357. X#define    DEBUGP    FALSE        /* Perm building */
  358. X#define    DEBUGB    FALSE        /* Best guess */
  359. X
  360. X#define    ATRLABEL1  \
  361. X"Auto Trigram, max SD: %4.2f total: %d wire: %d -- Please Wait"
  362. X#define    ATRLABEL2  \
  363. X"Auto Trigram, max SD: %4.2f total: %d wire: %d -- Done"
  364. X#define    ATRHELP         "F3 enters guess, ^G undoes it."
  365. X
  366. X
  367. Xextern    char    mcbuf[];
  368. Xextern    ecinfo    gecinfo;
  369. Xextern    atrdraw(), atrfirst(), atrenter(), atrundo();
  370. X
  371. X/* Gloabal State. */
  372. Xchar    *trigramstats;        /* Filename for statistics. */
  373. Xatrinfo    gatrinfo;
  374. Xkeyer    atrktab[] = {
  375. X        {CACCEPT, atrenter},
  376. X        {CUNDO, atrundo},
  377. X        {CGO_UP, jogup},
  378. X        {CGO_DOWN, jogdown},
  379. X        {CGO_LEFT, jogleft},
  380. X        {CGO_RIGHT, jogright},
  381. X        {0, NULL},
  382. X        };
  383. X
  384. X/* Routine invoked by user to put up the equivalence class
  385. X * guessing window.
  386. X * The window is drawn empty, and then filled in with the guess.
  387. X * Return NULL if command completes ok.
  388. X */
  389. Xchar    *atrguess(str)
  390. Xchar    *str;            /* Command line */
  391. X{
  392. X    gwindow    *atr;
  393. X    atrinfo    *atri;
  394. X    ecinfo    *ecbi;
  395. X    int        *dbsperm;
  396. X    int        i, c;
  397. X    int        classpos;
  398. X    int        x, y;
  399. X
  400. X    atr = &gbstore;
  401. X    atri = &gatrinfo;
  402. X    dbsperm = refperm(dbsgetblk(&dbstore));
  403. X    atr_init(mcbuf, dbsperm, atri);
  404. X    ecbi = atri->eci;
  405. X    atri->min_total_chars = 123;
  406. X    atri->min_wire_chars = 456;
  407. X
  408. X    if ((i = sscanf(str, "%*[^:]: %f %*[^:]: %d %*[^:]: %d",
  409. X        &atri->max_score, &atri->min_total_chars,
  410. X        &atri->min_wire_chars)) != 3)  {
  411. X            return("Could not parse all three arguments.");
  412. X        }
  413. X
  414. X    gbsswitch(atr, ((char *) atri), atrktab, atrfirst, wl_noop, atrdraw);
  415. X
  416. X    sprintf(statmsg, ATRLABEL1,
  417. X            atri->max_score, atri->min_total_chars, atri->min_wire_chars);
  418. X    gblset(&gblabel, statmsg);
  419. X    atrdraw(atr);
  420. X    fflush(stdout);
  421. X
  422. X    atr_autoguess(atri);
  423. X    decode(ecbi->ciphertext, ecbi->plaintext, ecbi->perm);
  424. X
  425. X    sprintf(statmsg, ATRLABEL2,
  426. X            atri->max_score, atri->min_total_chars, atri->min_wire_chars);
  427. X    gblset(&gblabel, statmsg);
  428. X    atrdraw(atr);
  429. X
  430. X    return(NULL);
  431. X}
  432. X
  433. X
  434. X/*  (re) Draw the window.
  435. X */
  436. Xatrdraw(atr)
  437. Xgwindow    *atr;
  438. X{
  439. X    int            i;
  440. X    int            row, col;
  441. X    atrinfo        *atri;
  442. X    ecinfo        *ecbi;
  443. X
  444. X    atri = ((atrinfo *) atr->wprivate);
  445. X    ecbi = atri->eci;
  446. X    row = 1;
  447. X    col = 1;
  448. X
  449. X    for (i = 0 ; i < BLOCKSIZE ; i++)  {
  450. X        if (i%LINELEN == 0) {
  451. X            wl_setcur(atr, gbspos2row(i), gbspos2col(i));
  452. X            }
  453. X        plnchars(1, char2sym(ecbi->plaintext[i]));
  454. X        }
  455. X
  456. X    for (i = gbspos2row(BLOCKSIZE) ; i <= GBHEIGHT ; i++) {
  457. X        wl_setcur(atr, i, 1);
  458. X        plnchars(LINELEN, ' ');
  459. X        }
  460. X
  461. X    for (i = 1 ; i <= GBHEIGHT ; i++) {
  462. X        wl_setcur(atr, i, LINELEN+1);
  463. X        plnchars(atr->wwidth - LINELEN, ' ');
  464. X        }
  465. X
  466. X    wl_setcur(atr, row, col);
  467. X}
  468. X
  469. X
  470. X/* First time cursor enters window.
  471. X */
  472. Xatrfirst(atr, row, col)
  473. Xgwindow    *atr;
  474. Xint            row, col;
  475. X{
  476. X    usrhelp(&user, ATRHELP);
  477. X    wl_setcur(atr, row, col);
  478. X}
  479. X
  480. X
  481. X/* Enter the guess into the decryption block.
  482. X */
  483. Xatrenter(atr)
  484. Xgwindow    *atr;
  485. X{
  486. X    atrinfo        *atri;
  487. X
  488. X    atri = ((atrinfo *) atr->wprivate);
  489. X    dbsmerge(&dbstore, atri->eci->perm);
  490. X    wl_rcursor(atr);
  491. X}
  492. X
  493. X
  494. X/* Undo the last guess.
  495. X */
  496. Xatrundo(atr)
  497. Xgwindow    *atr;
  498. X{
  499. X    dbsundo(&dbstore);
  500. X    wl_rcursor(atr);
  501. X}
  502. X
  503. X
  504. X/* Fill in auto-trigram info from given ciphertext block.
  505. X * The filter parameters are not set by this routine.
  506. X */
  507. Xatr_init(cipher, perm, atri)
  508. Xchar    cipher[];
  509. Xint        perm[];
  510. Xatrinfo    *atri;
  511. X{
  512. Xextern    int    *trig_loaded;
  513. X    int        i;
  514. X
  515. X    atri->eci = &gecinfo;
  516. X    if (!trig_loaded)
  517. X        load_tri_from(trigramstats);
  518. X    ec_init(cipher, perm, atri->eci);
  519. X    atr_guess_init(atri);
  520. X}
  521. X
  522. X
  523. X/* Per guess initialization.
  524. X */
  525. Xatr_guess_init(atri)
  526. Xatrinfo    *atri;
  527. X{
  528. X    atri->best_trigram = NULL;
  529. X    atri->best_score = 10.0;
  530. X    atri->gcount = 0;
  531. X    atri->total_score = 0;
  532. X    atri->best_pvec[0] = NONE;
  533. X    atri->best_permvec[0].x = NONE;
  534. X}
  535. X
  536. X
  537. X
  538. X/* Score a trigram at a given position.
  539. X * It also looks in atri for filtering parameters (total number
  540. X * of chars must not be less than min_total_chars, and the minimum number
  541. X * of chars deduced per wire must not be less than min_wire_chars).
  542. X * This routine fills in permvec and pvec.
  543. X * Returns -1.0 if guess is unacceptable.
  544. X */
  545. Xfloat    atr_score(atri, trigent, pos, permvec, pvec)
  546. Xatrinfo        *atri;
  547. Xtrig_ent    *trigent;
  548. Xint            pos;
  549. Xperment        permvec[];
  550. Xint            pvec[];
  551. X{
  552. X    int        length;
  553. X    int        i, x, y;
  554. X    int        ccount;
  555. X    int        added;
  556. X    extern    float    logvar;
  557. X    float    score;
  558. X    ecinfo    *eci;
  559. X    int        butfirst;
  560. X    int        butlast;
  561. X
  562. X    for (length = 0 ; trigent->trigram[length] != 0 ; length++);
  563. X    eci = atri->eci;
  564. X    added = permvec_from_string(atri->eci, trigent->trigram, pos, permvec);
  565. X    if (added < 0)  return(-1.0);
  566. X
  567. X    butfirst = pos;
  568. X    butlast = pos + length -1;
  569. X    ccount = 0;
  570. X
  571. X    for (i = 0 ; i < PERMSZ  &&  permvec[i].x != NONE ; i++)  {
  572. X        if (ccount >= BLOCKSIZE-1)  break;
  573. X        x = permvec[i].x;
  574. X        y = permvec[i].y;
  575. X/*        added = decode_wire_but(eci, x, y, &pvec[ccount], -1, -1);*/
  576. X        added = decode_wire_but(eci, x, y, &pvec[ccount], butfirst, butlast);
  577. X        if (added < 0)  {
  578. X            ccount = 0;
  579. X            break;
  580. X            }
  581. X        if (added < atri->min_wire_chars)  {
  582. X            ccount = 0;
  583. X            break;
  584. X            }
  585. X        ccount += added;
  586. X        }
  587. X    pvec[ccount] = -1;
  588. X
  589. X    if (ccount <= 0)  return(-1.0);
  590. X    if (ccount < atri->min_total_chars)  return(-1.0);
  591. X
  592. X    score = pvec_1score(pvec);
  593. X    if (score < 0.0)  return(-1.0);
  594. X/*
  595. X    score = exp(-(score * score) / 2.0);
  596. X    score = score / sqrt(2*PI*logvar/ccount);
  597. X    score = score * trigent->prob;
  598. X*/
  599. X    return(score);
  600. X}
  601. X
  602. X
  603. X/* Select the best trigram for a given position.
  604. X * Returns pointer to trigram string, or NULL.
  605. X * Fills in atri with additional information.
  606. X * Filtering parameters are in atri.
  607. X */
  608. Xchar    *atr_best(atri, pos)
  609. Xatrinfo    *atri;
  610. Xint        pos;
  611. X{
  612. X    int        tgram;
  613. X    float    score;
  614. X    perment    permvec[PERMSZ];
  615. X    int        pvec[BLOCKSIZE+1];
  616. X#if DEBUGB
  617. X    char    str[BLOCKSIZE+1];
  618. X#endif
  619. X
  620. X    atr_guess_init(atri);
  621. X
  622. X    for (tgram = 0 ; trig_tab[tgram].trigram != NULL ; tgram++)  {
  623. X        score = atr_score(atri, &trig_tab[tgram], pos, permvec, pvec);
  624. X        if (score < 0.0)  continue;
  625. X        atri->total_score += score;
  626. X        atri->gcount++;
  627. X        if (score < atri->best_score) {
  628. X            atri->best_score = score;
  629. X            atri->best_trigram = trig_tab[tgram].trigram;
  630. X            pvec_copy(pvec, atri->best_pvec);
  631. X            permvec_copy(permvec, atri->best_permvec, PERMSZ);
  632. X            }
  633. X        }
  634. X
  635. X#if DEBUGB
  636. X    if (atri->best_score < atri->max_score) {
  637. X        printf("\nTrigram '%s' at %d", atri->best_trigram, pos);
  638. X        pvec2str(str, atri->best_pvec);
  639. X        printf(" deduces '%s'", str);
  640. X        printf(" which scores as %g", atri->best_score);
  641. X        printf(".\n");
  642. X        }
  643. X#endif
  644. X
  645. X    if (atri->best_score < atri->max_score)
  646. X        {return(atri->best_trigram);}
  647. X    else
  648. X        {return(NULL);}
  649. X}
  650. X
  651. X
  652. X/* Merge the given permvector into the permutation table.
  653. X * Return ERROR if there is a conflict, otherwise TRUE.
  654. X */
  655. Xint    accept_permvec(atri, permvec)
  656. Xatrinfo    *atri;
  657. Xperment    permvec[];
  658. X{
  659. X    int        i, x, y;
  660. X    ecinfo    *ecbi;
  661. X
  662. X    ecbi = atri->eci;
  663. X    for (i = 0 ; i < PERMSZ  &&  permvec[i].x != NONE ; i++)  {
  664. X        x = MODMASK & permvec[i].x;
  665. X        y = MODMASK & permvec[i].y;
  666. X        if (perm_conflict(ecbi->perm, x, y)) {
  667. X#if DEBUGP
  668. X            printf("CONFLICT trying to wire %d to %d.\n", x, y);
  669. X#endif
  670. X            return(ERROR);
  671. X            }
  672. X        }
  673. X
  674. X
  675. X    /* Now know that there are no conflicts. */
  676. X    for (i = 0 ; i < PERMSZ  &&  permvec[i].x != NONE ; i++)  {
  677. X#if DEBUGP
  678. X        printf("ACCEPTING wiring of %d to %d.\n", x, y);
  679. X#endif
  680. X        x = MODMASK & permvec[i].x;
  681. X        y = MODMASK & permvec[i].y;
  682. X        ecbi->perm[x] = y;
  683. X        ecbi->perm[y] = x;
  684. X        }
  685. X
  686. X    return(TRUE);
  687. X}
  688. X
  689. X
  690. X
  691. X/* Perform automatic guessing given a set of
  692. X * filter parameters in an atrinfo structure.
  693. X */
  694. Xatr_autoguess(atri)
  695. Xatrinfo    *atri;
  696. X{
  697. X    int        pos;
  698. X    char    *trigram;
  699. X
  700. X    for (pos = 0 ; pos < BLOCKSIZE ; pos++) {
  701. X        trigram = atr_best(atri, pos);
  702. X        if (trigram != NULL) {
  703. X            accept_permvec(atri, atri->best_permvec);
  704. X            }
  705. X        }
  706. X}
  707. END_OF_autotri.c
  708. if test 7624 -ne `wc -c <autotri.c`; then
  709.     echo shar: \"autotri.c\" unpacked with wrong size!
  710. fi
  711. # end of overwriting check
  712. fi
  713. if test -f dline.c -a "${1}" != "-c" ; then 
  714.   echo shar: Will not over-write existing file \"dline.c\"
  715. else
  716. echo shar: Extracting \"dline.c\" \(6929 characters\)
  717. sed "s/^X//" >dline.c <<'END_OF_dline.c'
  718. X/*
  719. X * Library of display line routines.
  720. X *
  721. X * Robert W. Baldwin, December 1984.
  722. X */
  723. X
  724. X#include    <stdio.h>
  725. X#include    "window.h"
  726. X#include    "specs.h"
  727. X
  728. X
  729. X/* After clrdline is called the routines assume that there is
  730. X * a null character terminating the string at index w->wwidth.
  731. X * That is, the length of the display string is always equal
  732. X * the the (fixed) width of the line.
  733. X * The dl_length field behaves like the apparent string length.
  734. X * It is the column location of the last non-blank character.
  735. X * That is, an all blank line has a length of zero.
  736. X */
  737. X
  738. X/* INTERNAL PROCEDURES */
  739. X
  740. X/* Set the range of positions between firstcol and lastcol (inclusive) to
  741. X * the given string.  The string is padded on the right with spaces
  742. X * or truncated to make it fill the interval.
  743. X */
  744. Xsetarange(line, str, firstcol, lastcol)
  745. Xdispline    *line;
  746. Xchar        *str;
  747. Xint            firstcol, lastcol;
  748. X{
  749. X    int        i;
  750. X
  751. X    line->dl_length = 0;
  752. X    for (i = firstcol-1 ; i < lastcol ; i++)  {
  753. X        if (*str == 0)  break;
  754. X        if (*str != ' ')  line->dl_length = i+1;
  755. X        line->dl_chars[i] = *str++;
  756. X        }
  757. X
  758. X    for ( ; i < lastcol ; i++)  {
  759. X        line->dl_chars[i] = ' ';
  760. X        }
  761. X
  762. X    line->dl_chars[i] = '\000';
  763. X}
  764. X
  765. X
  766. X
  767. X/* PUBLIC PROCEDURES */
  768. X
  769. X
  770. X
  771. X/* Set the line from column, col, onward to the given string,
  772. X * padding with blanks if needed.  Note col = 1, set the whole line.
  773. X * This cannot be used to initialize a display line.  It does not
  774. X * set the character preceeding col.
  775. X */
  776. Xsetnadline(line, str, col)
  777. Xdispline    *line;
  778. Xchar        *str;
  779. Xint            col;
  780. X{
  781. X    setarange(line, str, col, line->wwidth);
  782. X}
  783. X
  784. X
  785. X/* Blank out all the characters in a displine.
  786. X */
  787. Xclrdline(line)
  788. Xdispline    *line;
  789. X{
  790. X    line->dl_length = 0;
  791. X    setarange(line, "", 1, line->wwidth);
  792. X}
  793. X
  794. X
  795. X/* Set the entire displine to the given string, padding with blanks.
  796. X * This fills in the null termination, so it can be used to initialize
  797. X * a display line.
  798. X */
  799. Xsetadline(line, str)
  800. Xdispline    *line;
  801. Xchar        *str;
  802. X{
  803. X    line->dl_length = 0;
  804. X    setarange(line, str, 1, line->wwidth);
  805. X}
  806. X
  807. X
  808. X/* Set characters in the given range to the string, truncating 
  809. X * if necessary.  Do not pad with blanks, just avoid overflowing
  810. X * the range.
  811. X */
  812. Xsetrange(line, str, firstcol, lastcol)
  813. Xdispline    *line;
  814. Xchar        *str;
  815. Xint            firstcol, lastcol;        /* Inclusive interval. */
  816. X{
  817. X    int        i;
  818. X    int        newlength;
  819. X
  820. X    newlength = 0;
  821. X    for (i = firstcol-1 ; i < lastcol ; i++)  {
  822. X        if (*str == 0)  return;
  823. X        if (*str != ' ')  newlength = i+1;
  824. X        line->dl_chars[i] = *str++;
  825. X        }
  826. X
  827. X    if (newlength > line->dl_length)  line->dl_length = newlength; 
  828. X}
  829. X
  830. X
  831. X
  832. X/* Starting at column, col, set the characters in the display line, line,
  833. X * to the given string, str.
  834. X * This differs from setnadline because it does not pad the line with blanks.
  835. X * Overflows are avoided by truncation.
  836. X * Note that col is a one-based position, not zero-based as strings are.
  837. X * This cannot be used to initialize a line, since it does not set the
  838. X * characters before column col.
  839. X */
  840. Xsetndline(line, str, col)
  841. Xdispline    *line;
  842. Xchar        *str;
  843. Xint            col;
  844. X{
  845. X    setrange(line, str, col, line->wwidth);
  846. X}
  847. X
  848. X
  849. X/* Set the variable part of the line (between min and max_col) to
  850. X * the given string.  Pad with blanks.
  851. X */
  852. Xdlsetvar(line, str)
  853. Xdispline    *line;
  854. Xchar        *str;
  855. X{
  856. X    setarange(line, str, line->dl_min_col, line->dl_max_col);
  857. X}
  858. X
  859. X
  860. X
  861. X/* Fill the given buffer from the given range of column positions.
  862. X * Trailing blanks are not removed.
  863. X */
  864. Xgetrange(line, buf, firstcol, lastcol)
  865. Xdispline    *line;
  866. Xchar        *buf;
  867. Xint            firstcol, lastcol;
  868. X{
  869. X    int        i;
  870. X
  871. X    for (i = firstcol-1 ; i < lastcol ; i++)  {
  872. X        *buf++ = line->dl_chars[i];
  873. X        }
  874. X    *buf = '\000';
  875. X}
  876. X
  877. X
  878. X/* Fill the given character buffer with a null terminated string
  879. X * corresponding to the part of the dline between the min and max
  880. X * column positions.  Trailing blanks are not removed.
  881. X */
  882. Xdlgetvar(line, buf)
  883. Xdispline    *line;
  884. Xchar        *buf;
  885. X{
  886. X    getrange(line, buf, line->dl_min_col, line->dl_max_col);
  887. X}
  888. X
  889. X
  890. X
  891. X/* EDITING PROCEDURES */
  892. X
  893. X
  894. X/* Insert the given character at the current cursor position.
  895. X * Do nothing if the line would become too long.
  896. X * Do nothing if the character is not printable.
  897. X * The cursor moves to the right one column, provided it doesn't
  898. X * move past dl_max_col.
  899. X */
  900. Xdlinsert(line, k)
  901. Xdispline    *line;
  902. Xkey            k;
  903. X{
  904. X    char    restbuf[MAXWIDTH+1];        /* Char from cursor to end. */
  905. X    char    insbuf[2];                    /* Char to insert. */
  906. X
  907. X    if (line->dl_length >= line->wwidth)  return;
  908. X    if (!printable(k))  return;
  909. X
  910. X    getrange(line, restbuf, line->wcur_col, line->wwidth);
  911. X
  912. X    insbuf[0] = k;
  913. X    insbuf[1] = '\000';
  914. X    setrange(line, insbuf, line->wcur_col, line->wcur_col);
  915. X
  916. X    setrange(line, restbuf, line->wcur_col+1, line->wwidth);
  917. X
  918. X    dlright(line);
  919. X}
  920. X
  921. X
  922. X/* Delete the character at the current cursor position and
  923. X * shuffle down the rest of the line.
  924. X * The cursor doesn't move.
  925. X * The non-blank length is correctly maintained.
  926. X */
  927. Xdldelete(line)
  928. Xdispline    *line;
  929. X{
  930. X    char    *p;
  931. X    char    linebuf[MAXWIDTH+1];        /* Rebuild whole line here. */
  932. X
  933. X    getrange(line, linebuf, 1, line->wcur_col-1);
  934. X
  935. X    for (p = linebuf ; *p != '\000' ; p++);    /* p pts to end of line. */
  936. X    getrange(line, p, line->wcur_col+1, line->wwidth);
  937. X    
  938. X    setadline(line, linebuf);
  939. X}
  940. X
  941. X
  942. X/* Move the cursor right within min and max column.
  943. X */
  944. Xdlright(line)
  945. Xdispline    *line;
  946. X{
  947. X    if (line->wcur_col+1 <= line->dl_max_col)
  948. X        line->wcur_col++;
  949. X}
  950. X
  951. X
  952. X/* Move the cursor left within min and max column.
  953. X */
  954. Xdlleft(line)
  955. Xdispline    *line;
  956. X{
  957. X    if (line->wcur_col-1 >= line->dl_min_col)
  958. X        line->wcur_col--;
  959. X}
  960. X
  961. X
  962. X
  963. X/* DISPLAY UPDATING PROCEDURES */
  964. X
  965. X
  966. X/* Redraw routine for a display line.
  967. X */
  968. Xwl_dldraw(dline)
  969. Xdispline    *dline;
  970. X{
  971. X    int        oldcolumn;
  972. X
  973. X    oldcolumn = dline->wcur_col;
  974. X
  975. X    wl_setcur(dline, 1, 1);
  976. X    plstring(dline->dl_chars);
  977. X    wl_setcur(dline, 1, oldcolumn);
  978. X}
  979. X
  980. X
  981. X/* Insert a character an redisplay the line.
  982. X */
  983. Xwl_dlinsert(line, k)
  984. Xdispline    *line;
  985. Xkey            k;
  986. X{
  987. X    dlinsert(line, k);
  988. X    wl_dldraw(line);
  989. X}
  990. X
  991. X
  992. X/* Delete the current character an redisplay the line.
  993. X */
  994. Xwl_dlfdel(line, k)
  995. Xdispline    *line;
  996. Xkey            k;
  997. X{
  998. X    dldelete(line, k);
  999. X    wl_dldraw(line);
  1000. X}
  1001. X
  1002. X
  1003. X/* Delete the previous character an redisplay the line.
  1004. X * The cursor moves backwards one position.
  1005. X */
  1006. Xwl_dlbdel(line, k)
  1007. Xdispline    *line;
  1008. Xkey            k;
  1009. X{
  1010. X    if (line->wcur_col == line->dl_min_col)  return;
  1011. X
  1012. X    dlleft(line);
  1013. X    dldelete(line, k);
  1014. X    wl_dldraw(line);
  1015. X}
  1016. X
  1017. X
  1018. X/* Move cursor right and update display.
  1019. X */
  1020. Xwl_dlright(line)
  1021. Xdispline    *line;
  1022. X{
  1023. X    dlright(line);
  1024. X    wl_rcursor(line);
  1025. X}
  1026. X
  1027. X
  1028. X/* Move cursor left and update display.
  1029. X */
  1030. Xwl_dlleft(line)
  1031. Xdispline    *line;
  1032. X{
  1033. X    dlleft(line);
  1034. X    wl_rcursor(line);
  1035. X}
  1036. X
  1037. X
  1038. X/* Clear the variable part of the display line and update the display.
  1039. X */
  1040. Xwl_dlclr(line)
  1041. Xdispline    *line;
  1042. X{
  1043. X    dlsetvar(line, "");
  1044. X    line->wcur_col = line->dl_min_col;
  1045. X    wl_dldraw(line);
  1046. X}
  1047. X
  1048. X
  1049. X/* Scan for the first argument place holder, '%',
  1050. X * position the cursor there, and delete it.
  1051. X * Do nothing if the line doesn't contain a '%'.
  1052. X */
  1053. Xwl_nxtarg(line)
  1054. Xdispline    *line;
  1055. X{
  1056. X    int        i;
  1057. X
  1058. X    for (i = line->dl_min_col-1 ; i < line->dl_max_col ; i++) {
  1059. X        if (line->dl_chars[i] != '%') continue;
  1060. X        wl_setcur(line, 1, i+1);
  1061. X        wl_dlfdel(line);
  1062. X        break;
  1063. X        }
  1064. X}
  1065. END_OF_dline.c
  1066. if test 6929 -ne `wc -c <dline.c`; then
  1067.     echo shar: \"dline.c\" unpacked with wrong size!
  1068. fi
  1069. # end of overwriting check
  1070. fi
  1071. if test -f specs.h -a "${1}" != "-c" ; then 
  1072.   echo shar: Will not over-write existing file \"specs.h\"
  1073. else
  1074. echo shar: Extracting \"specs.h\" \(6537 characters\)
  1075. sed "s/^X//" >specs.h <<'END_OF_specs.h'
  1076. X/*
  1077. X * Specifications of inter-module dependencies.
  1078. X *
  1079. X * Robert W. Baldwin, December 1984.
  1080. X */
  1081. X
  1082. X
  1083. X/* General Information. */
  1084. X
  1085. X/* A pvec is an 'string' of integers that represent plaintext
  1086. X *    characters.  The string is terminated by a -1.
  1087. X * A pbuf is a fixed length array of integers that represent plaintext
  1088. X *    characters.  A value of -1 means that the characters is unknown.
  1089. X * A cbuf is a fixed length array of bytes that represent ciphertext chars.
  1090. X * A perm is a mapping from shifted ciphertext characters to shifted
  1091. X *    plaintext characters.  Each character is shifted (incremented) by
  1092. X *    its offset in the block of 256 characters that contain it.
  1093. X * A gsi is a data structure about a guess that includes information
  1094. X *    on the characters that are assumed to be right.
  1095. X * An eci is a data structure that descibes a block of cipher and
  1096. X *    plain text.
  1097. X * A string is a null terminated vector of bytes.
  1098. X */
  1099. X
  1100. X
  1101. Xextern    twindow    banner;
  1102. Xextern    twindow    webster;
  1103. Xextern    twindow    dblabel;
  1104. Xextern    gwindow    dbstore;
  1105. Xextern    twindow    gblabel;
  1106. Xextern    gwindow    gbstore;
  1107. Xextern    twindow    user;
  1108. X
  1109. Xextern    gwindow    *ibanner();
  1110. Xextern    gwindow    *iwebster();
  1111. Xextern    gwindow    *idblabel();
  1112. Xextern    gwindow    *idbstore();
  1113. Xextern    gwindow    *igblabel();
  1114. Xextern    gwindow    *igbstore();
  1115. Xextern    gwindow    *iuser();
  1116. X
  1117. Xextern    char    *savestr();
  1118. Xextern    int    substrp(/* big, little */);
  1119. Xextern    int    read_slashed(/* *string */);
  1120. X
  1121. Xextern    char *(quitcmd(/* arg-string */));
  1122. Xextern    char *(lpbguess(/* arg-string */));
  1123. Xextern    char *(atrguess(/* arg-string */));
  1124. Xextern    char *(kntguess(/* arg-string */));
  1125. Xextern    char *(ecbguess(/* arg-string */));
  1126. Xextern    char *(pwdguess(/* arg-string */));
  1127. Xextern    char *(permsave(/* arg-string */));
  1128. Xextern    char *(permload(/* arg-string */));
  1129. Xextern    char *(webmatch(/* arg-string */));
  1130. Xextern    char *(clearzee(/* arg-string */));
  1131. Xextern    char *(pgate(/* arg-string */));
  1132. X
  1133. Xextern    char *(cmddo(/* cmdtab, string */));
  1134. Xextern    char *(cmdcomplete(/* cmdtab, string */));
  1135. Xextern    gblset(/* w, string */);
  1136. Xextern    gbsswitch(/* w, private, keytable, firsttime, lasttime, draw */);
  1137. Xextern    gbsclear(/* w */);
  1138. Xextern    hstadd(/* w, string */);
  1139. Xextern    usrstatus(/* w, string */);
  1140. Xextern    usrhelp(/* w, string */);
  1141. Xextern    dblbnum(/* w, int */);
  1142. Xextern    int    dbsmerge(/* w, perm */);
  1143. Xextern    dbssetblk(/* w, int */);
  1144. Xextern    int    dbsgetblk(/* w */);
  1145. Xextern    dbstrypq(/* ecbi, pque_hdr, pos */);
  1146. X
  1147. Xextern    float    score(/* pbuf */);
  1148. Xextern    float    gsi_1score(/* gsi */);        /* Uses 1st order stats. */
  1149. Xextern    float    gsi_2score(/* gsi */);        /* Uses 2nd order stats. */
  1150. Xextern    float    var_1score(/* pvec */);        /* Uses first order stats. */
  1151. Xextern    float    prob_1score(/* pvec */);    /* Uses first order stats. */
  1152. Xextern    float    pvec_1score(/* pvec */);    /* Uses first order stats. */
  1153. Xextern        load_1stats();            /* Loads first order stats. */
  1154. Xextern        print_1stats();
  1155. X
  1156. Xextern    int    decode(/* cbuf, pbuf, perm */); /* FALSE if has bad chars. */
  1157. X/* Return -1 if    bad chars, otherwise # of chars added to pvec. */
  1158. Xextern    int    decode_wire(/* eci, x, y, pvec */);
  1159. X/* Returns -1 if bad chars, otherwise # of chars added to pvec. */
  1160. Xextern    int    decode_class(/* eci, firstpos, firstplain, pvec */);
  1161. X/* Returns number of wires added to permvec assuming that plaintext
  1162. X * str occurs at pos.  Fills in permvec.  Returns -1 if conflict. */
  1163. Xextern    int    perm_from_string(/* eci, str, pos, permvec */);
  1164. X/* Fills in pvec with the plaintext characters deduced
  1165. X * from the wires in permvec that are not in the positions
  1166. X * ranging from butfirst to butlast.  Returns -1 if any
  1167. X * non-ascii chars are deduced, else count of chars. */
  1168. Xextern    int    permvec2pvec(/* eci, permvec, pvec, butfirst, butlast */);
  1169. Xextern        permvec_copy(/* from, to, maxnum */);
  1170. Xextern        pvec_copy(/* from, to, maxnum */);
  1171. Xextern        print_pvec(/* stream, pvec */);
  1172. Xextern        char2buf(/* cbuf, pbuf, length */);    /* Fills in pbuf. */
  1173. Xextern        buf2char(/* cbuf, pbuf, length, nonechar */); /* Fill cbuf. */
  1174. Xextern        str2pvec(/* string, pvec */);        /* Fills in pvec. */
  1175. Xextern        pvec2str(/* string, pvec */);        /* Fills in string. */
  1176. X
  1177. Xextern    int    fillcbuf(/* blocknum, *cbuf */);   /* Ret TRUE if sucessful. */
  1178. Xextern    int    *refperm(/* blocknum */);       /* Ret NULL if fails. */
  1179. Xextern    copyperm(/* src, dst */);
  1180. Xextern    readperm(/* fd, permbuffer */);    /* Gets chars from fd to fill perm. */
  1181. Xextern    writeperm(/* fd, permbuffer */);       /* Writes perm to file. */
  1182. Xextern    multperm(/* left, right, result = (left)(right) */);
  1183. Xextern    expperm(/* src, dst, k */);           /* dst = src ** k. */
  1184. Xextern    int    permcount(/* perm */);           /* Return # values != -1. */
  1185. Xextern    int    permwcount(/* perm */);           /* Return # of wires. */
  1186. X
  1187. Xextern        approx_init();        /* Call before fexp or isqrt. */
  1188. Xextern    float    fexp(/* float */);    /* Fast exp func. */
  1189. Xextern    float    isqrt[];        /* Sqrts of integers < BLOCKSIZE */
  1190. X
  1191. X
  1192. X/* Globals State */
  1193. Xextern    char    *cipherfile;        /* Ciphertext file name. */
  1194. Xextern    char    *permfile;        /* Permutation save file name. */
  1195. Xextern    char    *letterstats;        /* Single letter stat file name. */
  1196. Xextern    char    *bigramstats;        /* Letter pair statistics file name. */
  1197. Xextern    char    *trigramstats;        /* Trigram statistics file name. */
  1198. Xextern    int    permchgflg;            /* TRUE if perms chged since save. */
  1199. Xextern    char    statmsg[];        /* Buffer to build status messages. */
  1200. X
  1201. X
  1202. X/* Extensions to C */
  1203. X#ifndef reg
  1204. X#define    reg        register
  1205. X#endif
  1206. X#define    abs(x)    (((x) > 0) ? x : (0 - x))
  1207. X
  1208. X
  1209. X/* Macros */
  1210. X#define graphic(c)    (c & SYMBOL)
  1211. X#define notascii(c)    (c>127)
  1212. X#define printable(c)    ((32 <= c) && (c <= 126))
  1213. X#define lletter(c)    (('a'<= (c)) && ((c) <= 'z'))
  1214. X#define uletter(c)    (('A'<= (c)) && ((c) <= 'Z'))
  1215. X#define isspace(c)    ( ((c) == ' ') || ((c) == '\t') || ((c) == '\n') )
  1216. X#define isletter(c)    (lletter(c) || uletter(c))
  1217. X#define tolower(c)    ( uletter(c) ? ((c) - 'A' + 'a') : (c) )
  1218. X
  1219. X
  1220. X/* Constants */
  1221. X#define    BLOCKSIZE    256    /* Number of chars in a cipher block. */
  1222. X#define MODMASK        0377    /* Arithmetic mod 256. */
  1223. X#define    CHARMASK    0177    /* ASCII char mask. */
  1224. X#define    MAXCHAR        127    /* Highest ASCII value. */
  1225. X#define MXBIINDEX    40    /* Num different chars in a bigram. */
  1226. X#define LINELEN        64    /* Number of characters per line. */
  1227. X#define    NLINES        4    /* Number of line pairs. */
  1228. X#define    NONE        (-1)    /* No info on something. */
  1229. X#define    ERROR        (-1)    /* Procedure can't meet normal case specs. */
  1230. X#define    EOL        (-37)    /* A hack used by read_char() */
  1231. X#define    PI        (3.1415926)
  1232. X#define    NPERMS        15    /* Max number of blocks in a file. */
  1233. X
  1234. X#ifndef    TRUE
  1235. X#define    TRUE        1    /* The whole truth. */
  1236. X#endif
  1237. X#ifndef    FALSE
  1238. X#define    FALSE        0    /* Lies, falsehoods, etc. */
  1239. X#endif
  1240. X#ifndef NULL
  1241. X#define    NULL        0    /* A zero by any other name ... */
  1242. X#endif
  1243. END_OF_specs.h
  1244. if test 6537 -ne `wc -c <specs.h`; then
  1245.     echo shar: \"specs.h\" unpacked with wrong size!
  1246. fi
  1247. # end of overwriting check
  1248. fi
  1249. if test -f test.txt -a "${1}" != "-c" ; then 
  1250.   echo shar: Will not over-write existing file \"test.txt\"
  1251. else
  1252. echo shar: Extracting \"test.txt\" \(6305 characters\)
  1253. sed "s/^X//" >test.txt <<'END_OF_test.txt'
  1254. XThe data may be passed to the procedure through value
  1255. Xparameters, and return values obtained through reference parameters.
  1256. XThe caller is suspended pending the return of the callee.  However,
  1257. Xinvocations differ from local procedure calls in several important
  1258. Xways.  The first, which is particular to Eden, is the requirement of
  1259. Xan accompanying capability to name to the target Eject.  Therefore,
  1260. Xthe Eject programmer is quite aware of the fact that an invocation is
  1261. Xnot "just another procedure call".  A second difference is
  1262. Xperformance.  Invocations will be far slower than a local procedure
  1263. Xcall simply because there is more going on.  The Eden kernel must
  1264. Xlocal the target Eject; network traffic may be necessary if the target
  1265. XEject is not on the same machine; parameters must be packaged into a
  1266. Xmessage to be sent to the target Eject; the target Eject must
  1267. Xunpackage the message and call the desired procedure with the
  1268. Xparameter values; the target Eject must package the results into a
  1269. Xmessage to be sent to the invoking Eject; finally, the invoking Eject
  1270. Xmust unpackage the results and return them to the calling procedure.
  1271. XIn light of such a performance deficit, Eject programmers may be
  1272. Xreluctant to structure a particular collection of Ejects in novel ways
  1273. Xin order to avoid the invocation overhead.
  1274. X
  1275. XThe thesis of this paper is to demonstrate that acceptable performance
  1276. Xfor invocations can be obtained in the Eden environment by paying
  1277. Xclose attention to the design and implementation of modules that
  1278. Xsupport remote procedure calls.  For the purposes of this thesis, the
  1279. Xscope will be limited to the Ejects' point of view.  The Eden kernel
  1280. Xwill not be considered.
  1281. X
  1282. X\section{Some Background}\label{introbck}
  1283. X
  1284. XEden has had a long history of improvements to its invocation
  1285. Xmechanism.  Previous work has concentrated on removing extraneous {\it
  1286. Xinter-process communication} (IPC) messages.  Particularly in Eden's
  1287. Xcase, IPC messages are very expensive.  Eden is built on top of Unix;
  1288. Xtherefore, each IPC message from an Eject to the Eden kernel, and vice
  1289. Xversa, involves at least a Unix process switch and copying the IPC
  1290. Xmessage into and out of the Unix kernel.
  1291. X
  1292. XThe first versions of Eden required 14 IPC messages to be sent per
  1293. Xlocal invocation.  A local invocation occurs when the invoking Eject
  1294. Xand the target Eject reside on the same physical machine.
  1295. XWhat was 2-process kernel's role in this setup?
  1296. X
  1297. XThe 2-process Eden kernel was finally replaced by a 1-process Eden
  1298. Xkernel, immediately reducing the number of messages required for an
  1299. Xinvocation by eliminating the IPC messages between the two kernel
  1300. Xprocesses.
  1301. X
  1302. XThe final reduction in IPC messages sent per invocation occurred
  1303. Xduring the summer of 1984.  Two more IPC messages were eliminated.
  1304. XOne of the messages eliminated was the IPC message from the Eden
  1305. Xkernel to the invoking Eject that communicated the {\it invocation
  1306. Xhandle} assigned to that particular call.  It was replaced by a scheme
  1307. Xwhere the invoking Eject was allowed to generate its own {\it local
  1308. Xinvocation handle} to communicate with the Eden kernel, and the Eden
  1309. Xkernel would generate its own unique handle in order to communicate
  1310. Xwith another Eden kernel or the target Eject.  The Eden kernel
  1311. Xguarantees that the reply message to an invocation will be stamped
  1312. Xwith the invoking Eject-generated handle.  The other IPC message
  1313. Xeliminated was the status message from the Eden kernel to the target
  1314. XEject confirming the kernel's approval of the reply message (format,
  1315. Xor contents if capabilities were contained in the reply).  The more
  1316. Xlogical scheme of notifying the invoking Eject of the failure status
  1317. Xof the reply, or the actual reply if the status was success, is now
  1318. Xbeing used.  The result of all these improvements is shown in figure
  1319. X\ref{oldfig}.  (See section \ref{oldexp} for an explanation of figure
  1320. X\ref{oldfig}.)
  1321. X
  1322. X\section{Related Work}\label{introrel}
  1323. X
  1324. XNelson's thesis thoroughly examines remote procedure calls.  He
  1325. Xstudies a number of implementations, and proposes a design for
  1326. XEmmisary(?), a new RPC mechanism with excellent transparency and
  1327. Xexceptional performance.  To attain exceptional performance, Nelson
  1328. Xgives a list of "lessons" that an RPC mechanism must have.  The
  1329. Xlessons are summarized here for the reader:
  1330. X
  1331. X\begin{itemize}
  1332. X\end{itemize}
  1333. X
  1334. XIn designing an RPC mechanism, it is convenient to use a layer model.
  1335. XHowever, strict adherance to the layer model often results in poor
  1336. Ximplementations.  There is a prohibitive cost associated with highly
  1337. Xmodular implementations that cannot be tolerated in RPC
  1338. Ximplementations.  In proposing a solution to the asynchrony
  1339. Xproblem, Cooper\cite{soft} advocates "soft layering".  The idea of soft
  1340. Xlayering may be applied to any naturally layered system whose layers
  1341. Xmust work well together.
  1342. X
  1343. X\section{Structure of Thesis}\label{introstruct}
  1344. X
  1345. XChapter \ref{old} examines the deficiencies of the current Eden
  1346. Xinvocation mechanism.  The reader is taken on a tour through the
  1347. Xprocess of initiating an invocation and receiving its reply, and
  1348. Xreceiving a new invocation and replying to the invocation.
  1349. X
  1350. XChapter \ref{new} proposes restructuring the dispatcher module for
  1351. Xsynchronous invocations (by far the most heavily used form of
  1352. Xcommunication within Eden) and breaking down the "hard layering" that
  1353. Xcurrently exists between the various layers that support invocations,
  1354. Xfrom the Eject's point of view, in order to obtain significant
  1355. Xperformance gains.
  1356. X
  1357. X\chapter{A Closer Look at the Eden Invocation Mechanism}\label{old}
  1358. X
  1359. X\section{The Dispatcher -- Interface and Internals}\label{olddis}
  1360. X
  1361. X\section{Flow of Data -- CIP, Stub, and ESCII}\label{olddat}
  1362. X
  1363. X\section{Summary}\label{oldsum}
  1364. X
  1365. X\chapter{An Alternative Synchronous Invocation Mechanism}\label{new}
  1366. X
  1367. X\section{Assumptions and Limitations}\label{newass}
  1368. X
  1369. X\section{The Dispatcher -- Interface and Internals}\label{newdis}
  1370. X
  1371. X\section{A Word About Buffer Management}\label{newbuf}
  1372. X
  1373. X\section{Flow of Data -- CIP, Stub, and ESCII}\label{newdat}
  1374. X
  1375. X\section{Results and Timings}\label{newres}
  1376. X
  1377. X\section{Summary}\label{newsum}
  1378. X
  1379. X\chapter{Conclusions and Further Work}\label{concl}
  1380. X
  1381. X\section{Lessons Re-learned}\label{conles}
  1382. X
  1383. X\section{Soft Layering}\label{conlay}
  1384. X
  1385. X\section{Modularization and Interfaces}\label{conmod}
  1386. X
  1387. X\section{Further Work}\label{confur}
  1388. X
  1389. X\end{document}
  1390. X
  1391. END_OF_test.txt
  1392. if test 6305 -ne `wc -c <test.txt`; then
  1393.     echo shar: \"test.txt\" unpacked with wrong size!
  1394. fi
  1395. # end of overwriting check
  1396. fi
  1397. if test -f user.c -a "${1}" != "-c" ; then 
  1398.   echo shar: Will not over-write existing file \"user.c\"
  1399. else
  1400. echo shar: Extracting \"user.c\" \(7027 characters\)
  1401. sed "s/^X//" >user.c <<'END_OF_user.c'
  1402. X/*
  1403. X * User status and command window.
  1404. X *
  1405. X * Robert W. Baldwin, December 1984.
  1406. X *
  1407. X * Bob Baldwin 10/86.
  1408. X *  Formatting changes.
  1409. X *  Change usrdown to fix screen fall off bug.
  1410. X *  Change usrfirst to fix cursor pos so jumpcmd() works.
  1411. X */
  1412. X
  1413. X
  1414. X#include    <stdio.h>
  1415. X#include    "window.h"
  1416. X#include    "terminal.h"
  1417. X#include    "layout.h"
  1418. X#include    "specs.h"
  1419. X#include    "parser.h"
  1420. X
  1421. X
  1422. X#define    DONEMSG     "Command completed."
  1423. X#define    USRHLP    1        /* Offset for help line. */
  1424. X#define    USRSTAT    2        /* Offset for status line. */
  1425. X#define    USRCMD    3        /* Offset for command line. */
  1426. X
  1427. X
  1428. X/* Global space to build status messages. */
  1429. Xchar    statmsg[MAXWIDTH+1];
  1430. X
  1431. X
  1432. Xextern    int    usrfirst();    /* Defined below. */
  1433. Xextern    int    usrdokey();    /* Defined below. */
  1434. Xextern    int    usrdraw();    /* Defined below. */
  1435. Xextern    int    usrup();    /* Defined below. */
  1436. Xextern    int    usrdown();    /* Defined below. */
  1437. X
  1438. X
  1439. X/* Command table. */
  1440. X#define USRHTEXT \
  1441. X"bigram, knit, prop, load, save, lookup, clear, equiv, auto-tri, pword"
  1442. X
  1443. Xcmdent    usrcmdtab[] = {
  1444. X        {"quit-program permanently", quitcmd},
  1445. X{"auto-trigram max_dev: % min_total_chars: % min_wire_chars: %", atrguess},
  1446. X        {"knitting using blocks from: % to: %  Min show count: %", kntguess},
  1447. X        {"lookup-pattern: % in dictionary", webmatch},
  1448. X        {"equivalence-class guess, use accept level: % (try 2.0)", ecbguess},
  1449. X        {"pwords-from file: %  Max dev: % (try 1.0)", pwdguess},
  1450. X        {"load-permutations", permload},
  1451. X        {"save-permutations", permsave},
  1452. X        {"clear-zee permutation", clearzee},
  1453. X        {"propagate-info from: % to: % using Zee", pgate},
  1454. X        {"bigram-guess level: % (2.0), min_prob: % (0.15)", lpbguess},
  1455. X        {0, NULL},
  1456. X        };
  1457. X
  1458. X
  1459. X/* Keystroke table for the user area. */
  1460. Xextern    usrdocmd();
  1461. X
  1462. X/* Keystroke table for the whole user window.
  1463. X * The editing on the command line is handled by a sub-window.
  1464. X */
  1465. Xkeyer    usrktab[] = {
  1466. X        {CGO_UP, usrup},    /* Keep off help and status lines. */
  1467. X        {CGO_DOWN, usrdown},    /* Normal behavior ok. */
  1468. X        {CEXECUTE, usrdocmd},    /* Interprete a command. */
  1469. X        {0, NULL},        /* Handle other chars elsewhere. */
  1470. X        };
  1471. X
  1472. X/* Keystroke table for the command line sub-window.
  1473. X */
  1474. Xkeyer    cmdktab[] = {
  1475. X                {CNEXTARG, wl_nxtarg},
  1476. X        {CGO_LEFT, wl_dlleft},    /* Stay withing variable area. */
  1477. X        {CGO_RIGHT, wl_dlright},/* Stay withing variable area. */
  1478. X        {CDELF, wl_dlfdel},    /* Delete forward within var area. */
  1479. X        {CDELB, wl_dlbdel},    /* Delete backward within var area. */
  1480. X        {CCLRLINE, wl_dlclr},    /* Clear variable area. */
  1481. X        {CINSERT, wl_dlinsert},    /* All other chars self-insert. */
  1482. X        };
  1483. X
  1484. X
  1485. X/* Window for the user commands and program status. */
  1486. X
  1487. Xdispline usraline[USRHEIGHT];        /* Display lines for the user. */
  1488. Xdispline *usrlines[USRHEIGHT+1];    /* Pointers to them plus NULL. */
  1489. X
  1490. Xtwindow    user = {
  1491. X        USRROW,1,        /* Origin. */
  1492. X        USRHEIGHT, USRWIDTH,    /* Height and width. */
  1493. X        USRCMD+1, USRSCOL,    /* Initial (relative) cursor pos. */
  1494. X        NULL,            /* No private data. */
  1495. X        usrfirst,        /* Firstime = restore cursor pos. */
  1496. X        wl_noop,        /* Lasttime = do nothing. */
  1497. X        usrdraw,        /* Default draw routine. */
  1498. X        usrdokey,        /* Custom keystroke handler. */
  1499. X        usrktab,        /* Keystroke table. */
  1500. X        usrlines,
  1501. X};
  1502. X
  1503. X
  1504. X
  1505. X/* Display a string in the status area.
  1506. X * If the string is empty, this will clear the status area.
  1507. X * Put the cursor back where it was.
  1508. X *
  1509. X * The empty string is special case.  If the status line is
  1510. X * empty, then wcur_col = 1.  A second request to clear
  1511. X * the line is ignored.
  1512. X * If the line is not empty, wcur_col = dl_min_col.
  1513. X */
  1514. Xusrstatus(w, str)
  1515. Xtwindow    *w;
  1516. Xchar    *str;
  1517. X{
  1518. X    displine *line;
  1519. X    int     row, col;
  1520. X    
  1521. X    row = rowcursor();
  1522. X    col = colcursor();
  1523. X
  1524. X    line = w->dlines[USRSTAT];
  1525. X    if (*str == 0  &&  line->wcur_col == 1)
  1526. X          return;
  1527. X
  1528. X    dlsetvar(line, str);
  1529. X    (*(line->wredraw))(line);
  1530. X    setcursor(row, col);
  1531. X
  1532. X    line->wcur_col = (*str == 0) ? 1 : 2;
  1533. X}
  1534. X
  1535. X
  1536. X
  1537. X/* Display a string in the help area.
  1538. X * If the string is empty, this will clear the help area.
  1539. X * Put the cursor back where it was.
  1540. X */
  1541. Xusrhelp(w, str)
  1542. Xtwindow    *w;
  1543. Xchar    *str;
  1544. X{
  1545. X    displine *line;
  1546. X    int     row, col;
  1547. X    
  1548. X    row = rowcursor();
  1549. X    col = colcursor();
  1550. X
  1551. X    line = w->dlines[USRHLP];
  1552. X    dlsetvar(line, str);
  1553. X    (*(line->wredraw))(line);
  1554. X
  1555. X    setcursor(row, col);
  1556. X}
  1557. X
  1558. X
  1559. X
  1560. X/* Draw the user area.
  1561. X * Leaves the cursor on the command line.
  1562. X */
  1563. Xusrdraw(w)
  1564. Xtwindow    *w;
  1565. X{
  1566. X    wl_twdraw(w);
  1567. X}
  1568. X
  1569. X
  1570. X
  1571. X/* Make a window with a title and partial outline.
  1572. X */
  1573. Xgwindow *(iuser())
  1574. X{
  1575. X    int     i;
  1576. X    displine *line, *lines;
  1577. X    twindow     *w;
  1578. X
  1579. X    w = &user;
  1580. X    lines = usraline;
  1581. X    for (i = 0 ; i < w->wheight ; i++)  {
  1582. X        line = &lines[i];
  1583. X        line->worg_row = w->worg_row + i;
  1584. X        line->worg_col = w->worg_col;
  1585. X        line->wheight = 1;
  1586. X/* Fix bug on terminals that autowrap. */
  1587. X        line->wwidth = (i == USRCMD) ? w->wwidth - 1 : w->wwidth;
  1588. X        line->wcur_row = 1;
  1589. X        line->wcur_col = USRSCOL;
  1590. X        line->wfirst = wl_rcursor;
  1591. X        line->wlast = wl_noop;
  1592. X        line->wredraw = wl_dldraw;
  1593. X        line->wkey = dokey;
  1594. X        line->wkeyprocs = arwktab;
  1595. X        line->dl_min_col = USRSCOL;
  1596. X        line->dl_max_col = line->wwidth;
  1597. X        clrdline(line);
  1598. X        w->dlines[i] = line;
  1599. X        }
  1600. X    w->dlines[i] = NULL;
  1601. X
  1602. X    line = &lines[USRHLP];
  1603. X    setadline(line, "Help   : This feature not implemented");
  1604. X    line = &lines[USRSTAT];
  1605. X    setadline(line, "Status : ");
  1606. X    dlsetvar(line, "Just barely working");
  1607. X    line = &lines[USRCMD];
  1608. X    setadline(line, "Command: ");
  1609. X    line->wkeyprocs = cmdktab;
  1610. X
  1611. X    return((gwindow *) w);
  1612. X}
  1613. X
  1614. X
  1615. X/* Behavior of the up arrow key.
  1616. X * Move up to the window above us staying in the same column.
  1617. X */
  1618. Xusrup(w, k)
  1619. Xtwindow    *w;        /* The user window. */
  1620. Xkey    k;
  1621. X{
  1622. X    wl_setcur(w, 1, w->dlines[USRCMD]->wcur_col);
  1623. X    jogup(w, k);
  1624. X}
  1625. X
  1626. X
  1627. X/* Behavior of the down arrow key.
  1628. X * Move to command line.
  1629. X */
  1630. Xusrdown(w, k)
  1631. Xtwindow    *w;        /* The user window. */
  1632. Xkey    k;
  1633. X{
  1634. X    wl_setcur(w, USRHEIGHT, w->dlines[USRCMD]->wcur_col);
  1635. X}
  1636. X
  1637. X
  1638. X/* Behavior when cursor first enters the user window.
  1639. X * Move to the command line.
  1640. X */
  1641. Xusrfirst(w, row, col)
  1642. Xtwindow    *w;
  1643. Xint    row, col;    /* Place in window when cursor currently is. */
  1644. X{
  1645. X    displine *cmdline;
  1646. X
  1647. X    wl_setcur(w, USRHEIGHT, w->dlines[USRCMD]->wcur_col);
  1648. X    usrhelp(w, USRHTEXT);
  1649. X    cmdline = w->dlines[USRCMD];
  1650. X    (*(cmdline->wfirst))(cmdline, 1, col);
  1651. X}
  1652. X
  1653. X
  1654. X/* Keystroke handler for user window.
  1655. X * If it is not an up-arrow or down-arrow, pass it to the command line.
  1656. X */
  1657. Xusrdokey(w, k)
  1658. Xtwindow    *w;        /* The user window. */
  1659. Xkey    k;
  1660. X{
  1661. X    char     *expanded;    /* Expanded command line. */
  1662. X    char     cmdbuf[MAXWIDTH+1];
  1663. X    displine *cmdline;
  1664. X
  1665. X    cmdline = w->dlines[USRCMD];
  1666. X    usrstatus(&user, "");
  1667. X    if (ddokey(w, k, w->wkeyprocs))  {  /* If handled by top window. */
  1668. X        return;                /* Includes doit key. */
  1669. X    }
  1670. X
  1671. X    if (k == ((CINSERT << CMDSHIFT) | SPACE))  {
  1672. X        dlgetvar(cmdline, cmdbuf);
  1673. X        expanded = cmdcomplete(usrcmdtab, cmdbuf);
  1674. X        if (expanded != NULL)  {
  1675. X            dlsetvar(cmdline, expanded);
  1676. X            wl_dldraw(cmdline);
  1677. X            return;
  1678. X            }
  1679. X        }
  1680. X    (*(cmdline->wkey))(cmdline, k);    /* Else pass to sub-window. */
  1681. X}
  1682. X
  1683. X
  1684. X/* Interprete a command.
  1685. X */
  1686. Xusrdocmd(usr)
  1687. Xtwindow    *usr;
  1688. X{
  1689. X    char     cmdbuf[MAXWIDTH+1];
  1690. X    char     *errmsg;
  1691. X    displine *cmdline;
  1692. X
  1693. X    cmdline = usr->dlines[USRCMD];
  1694. X    wl_setcur(usr, usr->wcur_row, cmdline->wcur_col);
  1695. X    dlgetvar(cmdline, cmdbuf);
  1696. X    if ((errmsg = cmddo(usrcmdtab, cmdbuf)) == NULL)
  1697. X        errmsg = DONEMSG;
  1698. X    usrstatus(&user, errmsg);
  1699. X}
  1700. END_OF_user.c
  1701. if test 7027 -ne `wc -c <user.c`; then
  1702.     echo shar: \"user.c\" unpacked with wrong size!
  1703. fi
  1704. # end of overwriting check
  1705. fi
  1706. echo shar: End of archive 4 \(of 11\).
  1707. cp /dev/null ark4isdone
  1708. MISSING=""
  1709. for I in 1 2 3 4 5 6 7 8 9 10 11 ; do
  1710.     if test ! -f ark${I}isdone ; then
  1711.     MISSING="${MISSING} ${I}"
  1712.     fi
  1713. done
  1714. if test "${MISSING}" = "" ; then
  1715.     echo You have unpacked all 11 archives.
  1716.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1717. else
  1718.     echo You still need to unpack the following archives:
  1719.     echo "        " ${MISSING}
  1720. fi
  1721. ##  End of shell archive.
  1722. exit 0
  1723. -- 
  1724. Rich $alz            rsalz@pineapple.bbn.com
  1725. Cronus Project, BBN Labs    "Anger is an energy"
  1726.